You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[interop] This release introduces experimental support for Hilt @InstallIn and @EntryPoint interop.
Enabled with metro { interop { includeHilt() } }
A @DependencyGraph(<scope>) automatically merges every @InstallIn(<component>) @​Module (as a binding container) and @InstallIn(<component>) @​EntryPoint (as a supertype) whose <component> maps to <scope>.
The eight standard Android Hilt components map to their canonical scopes out of the box.
User-declared @DefineComponent interfaces are resolved on demand by looking for an annotation on the same interface whose annotation class is itself annotated with @Scope (Hilt's own convention).
Both consuming Hilt-generated aggregation deps and also treating @InstallIn + @EntryPoint/@Module as interop are supported.
See the docs for the details and current limitations.
Enhancements
[compat] Improve IDE kotlinc version resolution. IntelliJ uses custom tags like 2.4.0-ij261-64 that are a little tricky to decipher.
[FIR] Add diagnostic guidance around inline@Provides declarations. TL;DR, they only make sense for public providers.
[FIR/IR] Inline constant@Provides bindings directly into generated graph implementations when possible, avoiding generated factory calls for literals, nulls, object singletons, enum entries, class literals, and const property reads. This is enabled by default and can be disabled with the enable-provider-inlining compiler flag if you see any issues.
[IR] Add a member-naming-strategy compiler option for shortening generated member names in generated code. Accepts DESCRIPTIVE (default), TYPED (provider*/instance*/factory*), or MINIMAL (single collapsed provider* naming). See docs/performance.md for guidance.
[IR] Lazily compute cached hashCode and toString renders for compiler-internal type keys without delegation.
[IR] Propagate inline modifiers from @Provides functions to factory newInstance() functions.
[IR] Preserve concrete generated provider factory return types where possible instead of widening to Factory<T>. In the future, Metro may generate these as value classes and this will allow better compiler optimization in those scenarios.
[IR/IC] Optimize IC tracking by buffering lookup and expect/actual records during IR and flushing them once after graph validation, avoiding per-write synchronization on the hot path. This is enabled by default but can be disabled via the buffered-ic-tracking compiler option if it causes any issues.
[IR/IC] Use newer compiler DeclarationFinder APIs on Kotlin 2.3.20+. These have more granular search scopes plus automatic IC tracking.
[IR/runtime] Add internal primitive instance factories and use them where possible for primitive graph inputs and inlined providers.
[gradle] Add a metroEnv task that writes human-readable Metro/Kotlin/Gradle environment reports for bug reports.
[reporting] Add compiler stats to reporting.
[runtime] Rework DoubleCheck synchronization on JVM and native targets.
On JVM, scoped bindings now synchronize on the DoubleCheck instance's own monitor (like Dagger) instead of allocating a ReentrantLock per instance, which also eliminates the spurious ReservedStackAccess JVM warning.
On native targets, the previous spinlock impl is replaced with a reentrant init guard whose contended callers park on a process-wide condition variable instead of busy-waiting.
On Apple platforms, parked waiters additionally donate their QoS class to the initializing thread to avoid priority inversion.
Notes for virtual thread (i.e. Project Loom):
JDK 21–23: synchronized can pin a virtual thread to its carrier if a scoped provider blocks during its one-time init (JEP 444).
[FIR] Loosen nonPublicContributionSeverity if generateContributionProviders is enabled. Note it will still fire on internal @ExposeImplBinding-annotated types.
[FIR] Fix compatibility with IntelliJ 2026.1.3.
[FIR] Don't merge generated binding containers from @ContributesInto* declarations as supertypes when aggregating contributions.
[FIR/JS/Wasm] Fix cross-module contributed graph extension factories on KLIB backends. Nested @GraphExtension.Factory @​ContributesTo(...) factories are now emitted as contribution hints and promoted as direct supertypes where needed, avoiding unresolved downstream calls such as createGraph<AppGraph>().createChildGraph() on JS/Wasm.
[IR] Fix graph extensions inheriting a farther ancestor's contribution-provider binding when a closer parent graph already owns a scoped binding for the same key.
[IR] Fix dynamic graphs (createDynamicGraph/createDynamicGraphFactory) sharing a single generated impl across call sites in different files. The shared impl was a private (on the JVM, package-private) nested class placed under one call site, so call sites in other packages failed at runtime with IllegalAccessError, and removing the owning file caused NoClassDefFoundError. Generated impls are now cached per-file.
[IR] Fix IR graph nodes eagerly resolving supertypes.
[IR] Don't reserve an InstanceFactory field for graph inputs unless it's needed.
[interop] Read @IntoSet/@IntoMap/@MapKey multibinding annotations from external Dagger modules.
Changes
Promote @GraphPrivate to stable.
Promote @DefaultBinding to stable.
Promote generateContributionProviders (and @ExposeImplBinding) to stable.
[compat] Rework compat factory resolution for dev compiler versions. Dev builds now only prefer dev-track factories that share the same base version (i.e. the same trunk lineage, like a 2.4.20-dev-* factory for a 2.4.20-dev-* compiler). When crossing base versions, lower-base dev factories and stable factories now compete on version and the highest wins, so a 2.4.20-dev-* compiler picks a 2.4.0 stable factory over a stale 2.4.0-dev-* one.
[gradle] Add missing experimental annotations to the Gradle plugin's analysis APIs. Sorry these were not meant to be stabilized yet!
Build against Kotlin 2.4.0. Note the runtime artifacts still target Kotlin 2.3.0 and Metro supports a wide range of compiler versions. See the compatibility docs for a full table of compatible versions.
No longer test most Kotlin 2.4.0 pre-release builds. Kotlin 2.4.0-dev-2124is still tested because this appears to be roughly where IntelliJ platform 2026.1.x branched from.
Test Android Studio Quail 1 stable (2026.1.1.8).
Test Android Studio Quail 2 canaries (2026.1.2.4).
Test IntelliJ 2026.1.2.
Test IntelliJ 2026.1.3.
Contributors
Special thanks to the following contributors for contributing to this release!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependenciesProject dependencies related issue / PR
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.1.1→1.2.01.1.1→1.2.01.1.1→1.2.0Release Notes
ZacSweers/metro (dev.zacsweers.metro)
v1.2.0Compare Source
2026-06-10
New
@InstallInand@EntryPointinterop.metro { interop { includeHilt() } }@DependencyGraph(<scope>)automatically merges every@InstallIn(<component>) @​Module(as a binding container) and@InstallIn(<component>) @​EntryPoint(as a supertype) whose<component>maps to<scope>.@DefineComponentinterfaces are resolved on demand by looking for an annotation on the same interface whose annotation class is itself annotated with@Scope(Hilt's own convention).@InstallIn+@EntryPoint/@Moduleas interop are supported.Enhancements
2.4.0-ij261-64that are a little tricky to decipher.inline@Providesdeclarations. TL;DR, they only make sense for public providers.@Providesbindings directly into generated graph implementations when possible, avoiding generated factory calls for literals, nulls, object singletons, enum entries, class literals, andconstproperty reads. This is enabled by default and can be disabled with theenable-provider-inliningcompiler flag if you see any issues.member-naming-strategycompiler option for shortening generated member names in generated code. AcceptsDESCRIPTIVE(default),TYPED(provider*/instance*/factory*), orMINIMAL(single collapsedprovider*naming). See docs/performance.md for guidance.inlinemodifiers from@Providesfunctions to factorynewInstance()functions.Factory<T>. In the future, Metro may generate these as value classes and this will allow better compiler optimization in those scenarios.buffered-ic-trackingcompiler option if it causes any issues.DeclarationFinderAPIs on Kotlin2.3.20+. These have more granular search scopes plus automatic IC tracking.metroEnvtask that writes human-readable Metro/Kotlin/Gradle environment reports for bug reports.DoubleChecksynchronization on JVM and native targets.DoubleCheckinstance's own monitor (like Dagger) instead of allocating aReentrantLockper instance, which also eliminates the spuriousReservedStackAccessJVM warning.synchronizedcan pin a virtual thread to its carrier if a scoped provider blocks during its one-time init (JEP 444).Fixes
nonPublicContributionSeverityifgenerateContributionProvidersis enabled. Note it will still fire on internal@ExposeImplBinding-annotated types.2026.1.3.@ContributesInto*declarations as supertypes when aggregating contributions.@GraphExtension.Factory @​ContributesTo(...)factories are now emitted as contribution hints and promoted as direct supertypes where needed, avoiding unresolved downstream calls such ascreateGraph<AppGraph>().createChildGraph()on JS/Wasm.createDynamicGraph/createDynamicGraphFactory) sharing a single generated impl across call sites in different files. The shared impl was aprivate(on the JVM, package-private) nested class placed under one call site, so call sites in other packages failed at runtime withIllegalAccessError, and removing the owning file causedNoClassDefFoundError. Generated impls are now cached per-file.InstanceFactoryfield for graph inputs unless it's needed.@IntoSet/@IntoMap/@MapKeymultibinding annotations from external Dagger modules.Changes
@GraphPrivateto stable.@DefaultBindingto stable.generateContributionProviders(and@ExposeImplBinding) to stable.devcompiler versions. Dev builds now only prefer dev-track factories that share the same base version (i.e. the same trunk lineage, like a2.4.20-dev-*factory for a2.4.20-dev-*compiler). When crossing base versions, lower-base dev factories and stable factories now compete on version and the highest wins, so a2.4.20-dev-*compiler picks a2.4.0stable factory over a stale2.4.0-dev-*one.2.4.0. Note the runtime artifacts still target Kotlin2.3.0and Metro supports a wide range of compiler versions. See the compatibility docs for a full table of compatible versions.2.4.0pre-release builds. Kotlin2.4.0-dev-2124is still tested because this appears to be roughly where IntelliJ platform 2026.1.x branched from.2026.1.1.8).2026.1.2.4).2026.1.2.2026.1.3.Contributors
Special thanks to the following contributors for contributing to this release!
Consider sponsoring Metro's development
Go Knicks!
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.